package com.minimalist.lindi.mapper;

import com.minimalist.common.entity.lindi.po.LindiTradeApplicationOperator;
import com.mybatisflex.core.BaseMapper;
import com.mybatisflex.core.query.QueryWrapper;

import java.util.List;

/**
 * 林地指标平台_交易申请操作表 映射层。
 *
 * @author 11987
 * @since 2025-04-24
 */
public interface LindiTradeApplicationOperatorMapper extends
        BaseMapper<LindiTradeApplicationOperator>{

    /**
     * 根据交易申请操作ID查询交易申请操作
     *
     * @param tradeApplicationOperatorId 交易申请操作ID
     * @return 交易申请操作
     */
    default LindiTradeApplicationOperator selectTradeApplicationOperatorByTradeApplicationOperatorId(
            Long tradeApplicationOperatorId){
        return selectOneByQuery(QueryWrapper.create()
                .eq(LindiTradeApplicationOperator::getTradeApplicationOperatorId
                        , tradeApplicationOperatorId)
        );
    }

    /**
     * 根据交易申请ID查询交易申请操作
     *
     * @param tradeApplicationId 交易申请ID
     * @return 交易申请操作
     */
    default List<LindiTradeApplicationOperator> selectTradeApplicationOperatorsByApplicationId(
            Long tradeApplicationId){
        return selectListByQuery(QueryWrapper.create()
                .eq(LindiTradeApplicationOperator::getTradeApplicationId
                        , tradeApplicationId)
                .orderBy(LindiTradeApplicationOperator::getCreateTime, false)
        );
    }
}
